﻿using System;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.IO;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Police.Tests.Helpers
{
    using Police.Helpers;

    /// <summary>
    /// This is a test class for AssemblyHelperTest and is intended
    /// to contain all AssemblyHelperTest Unit Tests
    ///</summary>
    [TestClass()]
    public class AssemblyHelperTest
    {
        /// <summary>
        /// A test for Find
        ///</summary>
        [TestMethod]
        public void Test_Find_With_Generic_Type()
        {
            Assembly assembly = Assembly
                .GetExecutingAssembly()
                .GetReferencedAssemblies()
                .Where(a => a.Name == "Police")
                .Select(a => Assembly.Load(a.FullName))
                .FirstOrDefault();

            List<Type> founds = assembly.Find<IPreCommitRule>();
            Assert.IsTrue(founds.Count > 0, "No PreCommitRule found!");
        }
    }
}
